package com.example.airobotinterviewrecord.entity.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

public enum InterviewStatus {
    UNKNOWN(0, "未知状态"),
    PENDING(1, "待面试"),
    COMPLETED(2, "已完成"),
    CANCELLED(3, "已取消"),
    POSTPONED(4, "已延期");

    @EnumValue
    private final int code;
    private final String desc;

    InterviewStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    // 根据code获取枚举实例
    public static InterviewStatus fromCode(int code) {
        for (InterviewStatus status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的状态码: " + code);
    }
    @JsonValue
    public String getDesc() {
        return desc;
    }
    public int getCode() {
        return code;
    }

}